<?php $this->renderPartial('//common/header'); ?>
<div id="main">
<div class="container">
	<ul class="breadcrumb">
		<li><a href="<?php echo PIUrl::createUrl('/home/');?>"><?php echo translate("Trang chủ"); ?></a></li>
		<li><a href="<?php echo PIUrl::createUrl('/home/theme');?>"><?php echo translate("Giao diện"); ?></a></li>
		<?php if($title != ''):?>
			<li><span><?php echo $title; ?></span></li>
		<?php endif;?>
	</ul>
	<h2 class="title title-lg"><?php echo translate("Siêu thị website"); ?> <span class="title-sm"><?php echo $numberTheme." "	; ?><?php echo translate("giao diện"); ?></span></h2>
	<div class="page-web-supermarket">
		<div class="sidebar">
			<!-- SEARCH MORE -->
			<div class="search-more">
				<div class="heading">
					<h3><?php echo translate("Tìm kiếm nhiều"); ?></h3>
				</div>
				<?php if(!empty($arrCate)){ ?>
					<ul>
						<?php foreach($arrCate as $cate){ ?>
							<li class="cateSearch"><a class="<?php echo $cate->alias;  ?>" href="<?php echo PIUrl::createUrl('/home/theme', array("alias"=>$cate->alias));?>"><?php echo $cate->name; ?><i class="icon-ib icon-close-tag"></i></a></li>
						<?php } ?>
					</ul>
				<?php } ?>
			</div>
			<!-- FORM SEARCH -->
			<div class="wrap-form-search">
				<form action="" class="form-search">
					<input type="hidden" name="alias"  value="<?php echo (isset($_GET['alias']) ? $_GET['alias'] : null); ?>">
					<input type="search" name="name" value="<?php echo (isset($_GET['name'])) ? $_GET['name'] : ''; ?>" class="form-control" placeholder="Tìm kiếm">
					<button type="submit" name="search" class="text-hide icon-ib icon-search-white">Tìm</button>
				</form>
			</div>
			<div class="menu-stats">
				<p>Danh mục theme</p>
				<?php if(!empty($arrCateTheme)){ ?>
					<ul>
						<li>
							<a class="<?php echo (!isset($_GET['alias'])) ? 'active' : ''; ?>" href="<?php echo PIUrl::createUrl('/home/theme');?>">
								<span class="left">Tất cả</span>
								<span class="right"><?php echo $numberTheme	; ?></span>
							</a>
						</li>
						<?php foreach($arrCateTheme as $cateTheme){ ?>
						<li>
							<a class="<?php echo ((isset($_GET['alias']))&& $_GET['alias'] == $cateTheme->alias) ? 'active' : ''; ?>" href="<?php echo PIUrl::createUrl('/home/theme', array('alias'=>$cateTheme->alias));?>">
								<span class="left"><?php echo $cateTheme->name; ?></span>
								<span class="right"><?php echo $cateTheme->numberWebsite; ?></span>
							</a>
						</li>
						<?php } ?>
					</ul>
				<?php } ?>
			</div>
		</div>
		<div class="main-content">
			<form action="./" class="form-filter">
				<label for="">Lọc theo:</label>
				<select class="dropdown sort">
					<option value="created" selected>Ngày</option>
					<option value="id_categoiresWebsite" >Loại</option>
				</select>
			</form>
			<?php
				$this->widget('CLinkPager', array(
					'currentPage'=>$pages->getCurrentPage(),
					'itemCount'=>$item_count,
					'pageSize'=>$page_size,
					'maxButtonCount'=>5,
					'header'=>'',
					'htmlOptions'=>array('class'=>'pagination mt0'),
					'firstPageCssClass' => 'firstPage',
					'lastPageCssClass' => 'lastPage',
					'previousPageCssClass' => 'prev',
					'prevPageLabel' => 'Prev',
					'nextPageLabel' => 'Next',
				));
			?>
			<div class="clearfix"></div>
			<div class="box-list-preview web-supermarket">
				<?php if(!empty($arrTheme)){ ?>
					<ul>
						<?php foreach($arrTheme as $theme){ ?>
							<li>
								<a href="<?php echo PIUrl::createUrl('/home/themeDetail/', array('alias'=>$theme->alias));?>">
									<div class="wrap-image">
										<img src="<?php echo getImage($theme->image, 223, 165) ?>" alt="img" width="223" height="165">
										<i class="icon-ib icon-view"></i>
									</div>
									<h4><?php echo $theme->name; ?></h4>
								</a>
							</li>
						<?php } ?>
					</ul>
				<?php }else{ echo translate("Không tìm thấy giao diện!"); } ?>
			</div>
			<?php
				$this->widget('CLinkPager', array(
					'currentPage'=>$pages->getCurrentPage(),
					'itemCount'=>$item_count,
					'pageSize'=>$page_size,
					'maxButtonCount'=>5,
					'header'=>'',
					'htmlOptions'=>array('class'=>'pagination mt0'),
					'firstPageCssClass' => 'firstPage',
					'lastPageCssClass' => 'lastPage',
					'previousPageCssClass' => 'prev',
					'prevPageLabel' => 'Prev',
					'nextPageLabel' => 'Next',
				));
			?>
			<div class="clearfix"></div>
		</div>
		<div class="clearfix"></div>
	</div>
</div>
</div>

<div id="push"> </div>
</div>
<style>
.firstPage, .lastPage{display:none !important;}
.selected a{color: #ED3237 !important;}
</style>
<script>
	$(document).ready(function(){
		// thuc hien sap xep theme
		$(".sort").change(function(){
			var link = "<?php echo PIUrl::createUrl('/home/theme/'); ?>";
			link+= "?alias=<?php echo (isset($_GET['alias'])) ? $_GET['alias'] : null ?>";
			link+= "&name=<?php echo (isset($_GET['name'])) ? $_GET['name'] : null ?>";
			link+= "&sort="+ $(this).val();
			window.location.href = link;
		});
		
		// xoa danh muc ra khoi muc tim kiem nhiu nhat
		// $(".cateSearch a").click(function(){
			// var data =  $(this).attr("class");
			// $.ajax({
				// url:"<?php echo PIUrl::createUrl('/home/removeCateSearch/'); ?>"+"?alias="+data,
				// success:function(result){
					// if(result ==  true){
						// $(this).remove();
					// }
				// },
			// });
			// return false;
		// });
	})
</script>
<?php $this->renderPartial('//common/footer'); ?>